﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NodeSource.DataProvider.Cache;
using NodeSource.DataProvider.Excel;
using NodeSource.DataProvider.Sql;

namespace NodeSource.DataProvider
{
    public class DataProviderFactory
    {
        public static IDataProvider Create(Connection connection)
        {
            switch (connection.DataProviderType)
            {
                case DataProviderType.Sql:
                    return new SqlDataProvider(connection);
                case DataProviderType.Excel:
                    return new ExcelDataProvider();
                case DataProviderType.Cache:
                    return new CacheDataProvider();
                default:
                    return null;
            }
        }
    }
}
